export default {
	components: {

	},
	data() {
        return{
            total:0,
            hasNext:true,  //上拉是否有值
            mescroll:null,
            downOption:{
                auto:false
            },
            upOption: {
                auto:false,
                textNoMore:'END',
				noMoreSize: 4, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
				empty: {
					tip: '~ 暂无数据 ~', // 提示
					btnText: '去逛逛'
				}
			},
            logisticsList: [],
            candidates: [{name:'北京',num:30},{name:'南京',num:40},{name:'东京',num:50},{name:'武汉',num:60},{name:'上海',num:70},{name:'海口',num:80},{name:'上海',num:90}],
				visible:false,
                indicatorStyle: `height: 50px;`
        }
    },
    onLoad() {
		// this.getLogisticsListData();
	},
    methods:{
        getLogisticsListData(page,page_size) {
			this.http.sendRequest({
				api: this.api.home.logisticsListApi,
				data: {
					page: page,
					page_size: page_size
				},
				success: res => {
                    if (page == 1) this.logisticsList = [];
					this.logisticsList =this.logisticsList.concat(res.data.data) ;
                    this.total=res.data.total
                    // this.mescroll.endSuccess( res.data.total,  this.hasNext);
                    this.mescroll.endBySize(this.logisticsList.length,   this.total);

                    console.log(this.logisticsList,'---')
				},
				fail: err => {
                    this.mescroll.endErr();
				}
			});
		},

        search(res) {
            uni.showToast({
                title: '搜索：' + res.value,
                icon: 'none'
            })
        },
        cancel(res) {
            uni.showToast({
                title: '点击取消，输入值为：' + res.value,
                icon: 'none'
            })
        },
        getPark(){
            this.$refs.popup.open()
        },
        bindChange(){
            this.$refs.popup.close()

        },

        mescrollInit(mescroll) {
            console.log('mescrollInit')
            this.mescroll = mescroll;
        },
      
        /*下拉刷新的回调 */
		downCallback() {
          console.log(3)
			this.mescroll.resetUpScroll();
		},
        		/*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
		upCallback(page) {
            if(this.total&&this.logisticsList.length==this.total) {
                this.hasNext=false  //初始化有值
                console.log(1)
                return;
            }else{
                console.log(2)
                 this.getLogisticsListData(page.num, page.size);
            }

           
			
		
		},
	
    }
}